import React from 'react';
import { Button, Table ,Modal,Form ,Input} from "antd";
import { getTian } from "../apis/apis";
function Articleadd({handleCancel,setData}) {
    const onFinish= async(values) => {
  console.log('Success:', values);
  values.article.tagList=[values.article.tagList]
  values.article.categoryList=[values.article.categoryList]
  values.article.authorId=47529555
  const res=await getTian(values.article)
  handleCancel()
  setData()
};

const onFinishFailed= (errorInfo) => {
  console.log('Failed:', errorInfo);
};
    return (
        <div>
            <Form
    name="basic"
    labelCol={{ span: 8 }}
    wrapperCol={{ span: 16 }}
    style={{ maxWidth: 600 }}
    initialValues={{ remember: true }}
    onFinish={onFinish}
    onFinishFailed={onFinishFailed}
    autoComplete="off"
  >
    <Form.Item
      label="消息名称"
      name={["article","title"]}
      rules={[{ required: true, message: '消息名称未填写!' }]}
    >
      <Input />
    </Form.Item>
    <Form.Item
      label="消息描述"
      name={["article","content"]}
      rules={[{ required: true, message: '消息描述未填写!' }]}
    >
      <Input />
    </Form.Item>
    <Form.Item
      label="消息标签"
      name={["article","tagList"]}
      rules={[{ required: true, message: '消息标签未填写!' }]}
    >
      <Input />
    </Form.Item>
    <Form.Item
      label="消息分类"
      name={["article","categoryList"]}
      rules={[{ required: true, message: '消息分类未填写!' }]}
    >
      <Input />
    </Form.Item>

    

    <Form.Item label={null}>
      <Button type="primary" htmlType="submit">
        添加
      </Button>
    </Form.Item>
  </Form>
        </div>
    );
}

export default Articleadd;